//
//  EnvirViewController.m
//  Anyair
//
//  Created by karlcool on 14-5-14.
//  Copyright (c) 2014年 Karlcool. All rights reserved.
//

#import "EnvirViewController.h"
#import "PMViewController.h"

@interface EnvirViewController ()

@end

@implementation EnvirViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    
    self.view.backgroundColor = AIR_GRAY;

    UIButton *pmBtn = [[UIButton alloc]initWithFrame:CGRectMake(15.5, ORGIN_Y, 289, 81)];
    if (!IOS_7) {
        pmBtn.frame = CGRectMake(15.5, ORGIN_Y_6, 289, 81);
    }
    pmBtn.tag = 0;
    [pmBtn setBackgroundImage:[UIImage imageNamed:@"Hbutton01"] forState:UIControlStateNormal];
    [pmBtn setTitle:@"PM2.5含量" forState:UIControlStateNormal];
    pmBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    pmBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    pmBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 120, 0, 0);
    [pmBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [pmBtn setBackgroundColor:AIR_GRAY];
    [pmBtn addTarget:self action:@selector(enterData:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:pmBtn];
    
    UIButton *oxyBtn = [[UIButton alloc]initWithFrame:CGRectMake(15.5, pmBtn.frame.origin.y+81+20, 289, 81)];
    oxyBtn.tag = 1;
    [oxyBtn setBackgroundImage:[UIImage imageNamed:@"Hbutton02"] forState:UIControlStateNormal];
    [oxyBtn setTitle:@"缺氧含量" forState:UIControlStateNormal];
    oxyBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    oxyBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    oxyBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 120, 0, 0);
    [oxyBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [oxyBtn setBackgroundColor:AIR_GRAY];
    [oxyBtn addTarget:self action:@selector(enterData:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:oxyBtn];
    
    UIButton *methBtn = [[UIButton alloc]initWithFrame:CGRectMake(15.5, pmBtn.frame.origin.y+162+40, 289, 81)];
    methBtn.tag = 2;
    [methBtn setBackgroundImage:[UIImage imageNamed:@"Hbutton03"] forState:UIControlStateNormal];
    [methBtn setTitle:@"甲醛含量" forState:UIControlStateNormal];
    methBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    methBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    methBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 120, 0, 0);
    [methBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [methBtn setBackgroundColor:AIR_GRAY];
    [methBtn addTarget:self action:@selector(enterData:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:methBtn];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)enterData:(UIButton*)sender {
    PMViewController *pm = [[PMViewController alloc]initWithType:sender.tag];
    [self.navigationController pushViewController:pm animated:YES];
}

@end
